<script setup>
import { appStore } from '@/sotre/modules/app';

const { userInfo } = toRefs(appStore());
const $get = inject('$get');

const total = ref(0);
const search = reactive({
    pageIndex: 1,
    pageSize: 30,
    payUid: userInfo.value.uid,
    enterpriseId: userInfo.value.lastEnterpriseId,
});

const dataList = ref([]);

function getList() {
    $get('/platform/platformMembersOrder/queryOrderByEnterprise', search).then(res => {
        total.value = res.total;
        dataList.value = res.rows;
    });
}
getList();
</script>

<template>
    <div class="vip-order">
        <wd-table :data="dataList" height="80vh" stripe>
            <wd-table-col prop="orderNo" label="订单号" align="center" width="150px"></wd-table-col>
            <wd-table-col prop="title" label="套餐" align="center"></wd-table-col>
            <wd-table-col prop="price" label="金额" align="center"></wd-table-col>
            <wd-table-col prop="state" label="状态" align="center" width="150px">
                <template #value="{ row }">
                    <text v-if="row.state == 1" type="success">{{ '有效' }}</text>
                    <text v-if="row.state == 0" type="danger">{{ '无效' }}</text>
                    <text v-if="row.state == 2" type="warning">{{ '待生效（未付款' }}</text>
                    <text v-if="row.state == 3" type="warning">{{ '已过期' }}</text>
                    <text v-if="row.state == 4" type="warning">
                        {{ '已被续费(无法使用)' }}
                    </text>
                    <text v-if="row.state == 5" type="warning">{{ '待退款（可使用）' }}</text>
                    <text v-if="row.state == 6" type="warning">{{ '已退款(无法使用)' }}</text>
                    <text v-if="row.state == 7" type="warning">{{ '已取消' }}</text>
                </template>
            </wd-table-col>
            <wd-table-col prop="createTime" label="购买时间" align="center"></wd-table-col>
            <wd-table-col prop="duration" label="到期时间" align="center"></wd-table-col>
        </wd-table>
        <wd-pagination
            custom-style="border: 1px solid #ececec;border-top:none"
            v-model="search.pageIndex"
            :page-size="search.pageSize"
            :total="total"
            @change="getList"
        ></wd-pagination>
    </div>
</template>

<style scoped lang="scss"></style>
